package com.example.springbott.service;

import com.example.springbott.bean.common.InnerStatGoods;
import com.example.springbott.bean.common.InnerStatOrderVO;
import com.example.springbott.bean.common.RawsInStatUser;
import com.example.springbott.bean.common.StatUserVO;
import com.example.springbott.mapper.MarketGoodsMapper;
import com.example.springbott.mapper.MarketOrderMapper;
import com.example.springbott.mapper.MarketUserMapper;
import com.example.springbott.util.Count;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.List;

/**
 * @author 1784549954@qq.com
 * @since 2022/11/20 16:52
 */
@Service
public class AdminStatServiceImpl implements AdminStatService{

    @Autowired
    MarketUserMapper marketUserMapper;

    @Autowired
    MarketOrderMapper marketOrderMapper;

    @Autowired
    MarketGoodsMapper marketGoodsMapper;

    @Override
    public StatUserVO statUser() {
        StatUserVO statUserVO = new StatUserVO();
        statUserVO.setColumns(Arrays.asList(Count.MALL_USER_RAWS));
        List<RawsInStatUser> raws = marketUserMapper.statUser();
        statUserVO.setRows(raws);
        return statUserVO;
    }

    @Override
    public StatUserVO statOrder() {
        StatUserVO statUserVO = new StatUserVO();
        statUserVO.setColumns(Arrays.asList(Count.MALL_ORDER_RAWS));
        List<InnerStatOrderVO> list = marketOrderMapper.statOrder();
        statUserVO.setRows(list);
        return statUserVO;
    }

    @Override
    public StatUserVO statGoods() {
        StatUserVO statUserVO = new StatUserVO();
        statUserVO.setColumns(Arrays.asList(Count.MALL_GOODS_RAWS));
        List<InnerStatGoods> list = marketGoodsMapper.statGoods();
        statUserVO.setRows(list);
        return statUserVO;
    }
}
